/*
 * Ganesa Copyright (C) 2008 Wim Crols <twimpiex@gnx.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package be.gnx.ganesa.plugin.osm.plugin;

import java.util.Vector;

import org.eclipse.swt.widgets.Composite;

import be.gnx.ganesa.application.command.ImportCommand;
import be.gnx.ganesa.application.model.Application;
import be.gnx.ganesa.application.model.Layer;
import be.gnx.ganesa.application.plugin.ImportPlugin;
import be.gnx.ganesa.application.ui.dialog.ImportDialog.ImportDialogResult;
import be.gnx.ganesa.application.ui.widget.ImportTabItemControl;
import be.gnx.ganesa.plugin.gpx.model.GPX;
import be.gnx.ganesa.plugin.osm.model.OSM;

public class OSMImport extends ImportPlugin {

  @Override
  public ImportCommand newImportCommand(Application application, ImportDialogResult importDialogResult) {
    return new be.gnx.ganesa.plugin.osm.command.ImportCommand(application, importDialogResult, this);
  }

  @Override
  public ImportTabItemControl newImportTabItemControl(Composite parent, int style) {
    return new be.gnx.ganesa.plugin.osm.ui.widget.ImportTabItemControl(parent, style);
  }

  @Override
  public Vector<Layer> newLayers(ImportDialogResult importDialogResult) {
    Vector<Layer> newLayers = new Vector<Layer>();
    newLayers.add(new OSM("OSM", importDialogResult.boundingBoxTabItemControl.getBoundingBox()));
    if (((be.gnx.ganesa.plugin.osm.ui.widget.ImportTabItemControl) importDialogResult.importTabItemControl).isDownloadGpxData()) {
      newLayers.add(new GPX("OSM GPX", importDialogResult.boundingBoxTabItemControl.getBoundingBox()));
    }
    return newLayers;
  }

}
